package com.mowh.multithreading.two.phase.termination;

/**
 * @author mowh1gd
 * @create 2023/11/24 18:37
 */
public class Main {
    public static void main(String[] args) {
        System.out.println("main: BEGIN");
        try {
            CountUpThread countUpThread = new CountUpThread();
            countUpThread.start();
            Thread.sleep(10000);
            System.out.println("main: shutdownRequest");
            countUpThread.shutdownRequest();
            System.out.println("main: join");
            countUpThread.join();//join是等待，等待某线程的“线程终止”操作的发生，这是countUpThread线程与main主线程同步的方法之一。
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("main: END");
    }
}
